In many applications, pulse-width modulation (PWM) is used to control the supply of electrical power to another device (or electrical load). For example, PWM techniques may be used to regulate the voltage provided by an energy source to drive an electric motor. In general, PWM utilizes a square wave whose pulse width is modulated (that is, the duty cycle of the square wave is varied) such that the average value of the waveform is equal to the desired output signal level. For example, switched-mode power supplies utilize transistors which are turned on and off with a duty cycle based on previously determined PWM commands, such that the average voltage at the output of the switched-mode power supply is substantially (or approximately) equal to the desired voltage level for the electrical load connected to the output. Often, the output voltage level is measured and used to dynamically adjust the duty cycles for the PWM signals for upcoming intervals by comparing the measured output voltage level to a desired voltage level. For example, if the desired voltage level is greater than the measured output voltage level, the duty cycle of the PWM signal may be increased. In this manner, the duty cycles for the PWM signals may be dynamically determined and adjusted based on real-time operating conditions.
In general, it is desirable to measure or obtain the output voltage level at known times within a PWM interval (the period of the current PWM signals). In this regard, some prior art systems measure the output voltage levels based on a predetermined sequence by performing a fixed number of analog-to-digital conversions spaced at fixed intervals that are not adjustable during operation. The predetermined sequence runs to completion before generating an interrupt service request which is subsequently handled and/or processed by software. However, when the PWM signals are dynamically determined, the particular times when it is desirable to measure the output voltage level may vary for each PWM interval. Other prior art systems support scheduling the predetermined sequence for analog-to-digital conversions based on a hardware trigger signal, thereby allowing the sequence to begin at a different time within the PWM interval. However, the fixed intervals between analog-to-digital conversions are not adjustable. Thus, in order to schedule and perform analog-to-digital conversions in an irregular and/or dynamic manner that varies by PWM interval, the prior art results in a relatively high number of interrupts and software overhead. As the frequency of the PWM signals increases, the software overhead limits the ability to dynamically schedule and/or perform a desired number of analog-to-digital conversions during the PWM interval.